<?php $this->import('Header') ?>
<style type="text/css">
    * {
        margin: 0px;
        padding: 0px;
    }
</style>
<script type="text/javascript" src="<?php echo \Entity\Domain::instance()->baiduMap ?>"></script>
<div id="body">
	<div class="index-photo-carousel min-width">
		<img class="index-photo-img" src="/images/index_photo.png">
		<div class="position-rel container index-rel-div">
			<div class="index-photo-point container position-abs">
				<div class="index-photo-point-maxdiv">
				</div>
				<br class="clear"/>
			</div>
		</div>
		<br class="clear"/>
	</div>

	<div class="index-body-maxdiv">
		<div class="index-body-div-black">
			<div class="position-rel container">
				<div class="index-body-image-box position-abs">
					<div class="index-body-image-div">
                        <div id="slide">
                            <ul>
                                    <li><a></a><img src="images/1.jpg" alt="" class="imgs" /></li>
                                    <li><a></a><img src="images/com_map.png" alt="" class="imgs" /></li>
                                    <li><a></a><img src="images/news.png" alt="" class="imgs" /></li>
                                    <li><a></a><img src="images/por.png" alt="" class="imgs" /></li>
                                    <li><a></a><img src="images/wen.png" alt="" class="imgs" /></li>
                                <?php foreach($homeLeftAdvertising as $val){?>
<!--                                    <li ><a href="--><?php //echo $val['Url']?><!--"><img src="--><?php //echo $val['Cover'];?><!--" class="imgs" ></a></li>-->
                                <?php }?>
                            </ul>
                        </div>
					</div>
					<div id="js-img-count" class="index-body-image-num">5/<?php echo count($homeLeftAdvertising);?></div>
					<center>
						<div class="index-body-image-direction">
							<img id="btnLeft" src="/images/left.png" class="unslider-arrow prev"/>
							<img id="btnRight" src="/images/right.png" class="unslider-arrow next">
						</div>
					</center>
				</div>
			</div>
		</div>
		<div class="container">
			<div class="index-body-doc-div">
				<div class="index-body-doc-fleft index-body-journalism">
					<div class="index-body-doc-title-div">
						<div class="index-body-doc-title">新闻资讯</div>
						<div class="index-body-doc-titleBox">
                            <div class="index-body-doc-comjour index-comjour-left index-body-doc-comjour-active js-index-comjour" flag="0">公司新闻</div>
                            <div class="index-body-doc-comjour index-comjour-right js-index-comjour" flag="1">公司公告</div>
						</div>
						<br class="clear"/>
					</div>

                    <div class="index-body-jourText">
                        <div class="js-index-news">
                            <?php foreach($journalism as $val){?>
                                <a href="/Article/Detail?id=<?php echo $val['Id'];?>" class="index-body-jourText-div">
                                    <div class="index-body-jourText-title">
                                        <?php echo $val['Title'];?>
                                    </div>
                                    <div class="index-body-jourText-date">
                                        <?php echo date('Y-m-d',$val['UpdateTime']);?>
                                    </div>
                                </a>
                            <?php }?>
                        </div>
                        <div class="js-index-cont none">
                            <?php foreach($notice as $val){?>
                                <a href="/Article/Detail?id=<?php echo $val['Id'];?>" class="index-body-jourText-div">
                                    <div class="index-body-jourText-title">
                                        <?php echo $val['Title'];?>
                                    </div>
                                    <div class="index-body-jourText-date">
                                        <?php echo date('Y-m-d',$val['UpdateTime']);?>
                                    </div>
                                </a>
                            <?php }?>
                        </div>
                    </div>
				</div>

				<div class="index-body-doc-fleft index-body-recruit">
					<div class="index-body-recruit-title">人才招募</div>
					<a href="/column/8" class="index-body-recruit-img">
						<img src="/images/join.png">
					</a>
				</div>

				<div class="index-body-doc-fleft index-body-blue-btn">
                    <?php foreach($homeRightAdvertising as $val){?>
                        <a href="javascript:void(0);" class="index-body-blue-btn-div">
                            <div class="index-body-blue-btn-maxdiv">
                                <img src="/images/lvbo.png" width="27" height="28"><?php echo $val['Title'];?>
                            </div>
                        </a>
                    <?php }?>
				</div>
				<br class="clear"/>
			</div>
			<br class="clear"/>
		</div>

	</div>

	<div class="index-company-address min-width">
        <div class="container index-company-add-map" id="baidu-map" style="width: 1100px;height: 333px;"></div>
	</div>
</div>
<?php $this->import('Footer') ?>
<script>
    window.onload = function() {
        var oSlide = document.getElementById("slide");
        var oUl = oSlide.getElementsByTagName("ul");
        var aLi = oUl[0].getElementsByTagName("li");
        var oBtnLeft = document.getElementById("btnLeft");
        var oBtnRight = document.getElementById("btnRight");

        var baseWidth = aLi[0].offsetWidth;
        //alert(baseWidth);
        oUl[0].style.width = baseWidth * aLi.length + "px";
        var iNow = 0;
        for(var i=0;i<aLi.length;i++) {
            aLi[i].index = i;
            aLi[i].onclick = function() {
                //alert(this.index);
                //alert(oUl[0].style.left);
                move(this.index);
                //aIco[this.index].className = "active";
            }
        }
        oBtnLeft.onclick = function() {
            iNow --;
            move(iNow);
        }
        oBtnRight.onclick = function() {
            iNow ++;
            move(iNow);
        }

        var curIndex = 0;
        var timeInterval = 1000;
        setInterval(change,timeInterval);
        function change() {
            if(curIndex == aLi.length) {
                curIndex =0;
            } else {
                move(curIndex);
                curIndex += 1;
            }
        }
        function move(index) {
            //document.title = index;
            if(index>aLi.length-1) {
                index = 0;
                iNow = index;
            }
            if(index<0) {
                index = aLi.length - 1;
                iNow = index;
            }
            for(var n=0;n<aLi.length;n++) {
                aLi[n].className = "";
            }
            aLi[index].className = "active";
            oUl[0].style.left = -index * baseWidth + "px";
            $("#js-img-count").html((index+1)+"/"+5);
            //buffer(oUl[0],{
            // left: -index * baseWidth
            // },8)

        }
    }
    $('.js-index-comjour').on("click", function() {
        var flag = $(this).attr('flag');
        var news = $('.js-index-news');
        var cont = $('.js-index-cont');
        if(flag == "0" && news.css('display') == "none") {
            news.css('display', 'block');
            cont.css('display', 'none');
            $(this).addClass('index-body-doc-comjour-active');
            $(this).next().removeClass('index-body-doc-comjour-active');
        }
        if(flag == "1" && cont.css('display') == "none") {
            cont.css('display', 'block');
            news.css('display', 'none');
            $(this).addClass('index-body-doc-comjour-active');
            $(this).prev().removeClass('index-body-doc-comjour-active');
        }
    });
</script>